package test_new;

import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Scanner;


public class GetFileContentFromFile {	
	
static String filename = "E:/Java/Tasks/Text_for_tasks/Text_for_tasks.txt";

public static void main(String[] args) throws IOException{
	
	show(getFileToList());
}	

public static Iterable<String> getFileToList() throws IOException {
	 FileReader fr = new FileReader (filename);
	try {		
		Scanner scan = new Scanner(fr);
		Collection<String> lines = new ArrayList<String>();
		while (scan.hasNextLine()) {
		       lines.add(scan.nextLine());		
		}

		return lines;
		
	} finally { 
		fr.close();
	}
	
									}
public static void show(Iterable<String> array){
    System.out.println("Стих: ");
            for (String s : array) {
            System.out.println(s);
            }
        }

	
}
